package member;

import com.opensymphony.xwork2.ActionSupport;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;

	public class ZipCheckAction extends ActionSupport {

		public static Reader reader;  
		public static SqlMapClient sqlMapper; 
		
		private String area3;
		
		private List<ZipcodeVo> zipcodeList = new ArrayList<ZipcodeVo>();
		
		public ZipCheckAction() throws IOException {
			reader = Resources.getResourceAsReader("sqlMapConfig.xml"); 
			sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader); 
			reader.close();
		}
		
		public String execute() throws Exception {
			//System.out.println(getArea3());
			zipcodeList = sqlMapper.queryForList("zipCheck", "%"+getArea3()+"%");
			//System.out.println(zipcodeList);
			return SUCCESS;
		}
		

		public String getArea3() {
			return area3;
		}

		public void setArea3(String area3) {
			this.area3 = area3;
		}

		public List<ZipcodeVo> getZipcodeList() {
			return zipcodeList;
		}

		public void setZipcodeList(List<ZipcodeVo> zipcodeList) {
			this.zipcodeList = zipcodeList;
		}
	}
